<template>
  <div v-loading="loading" class="list-table" style="height: 100%;">
    <div class="area-header">
      <span class="area-header-title">{{ $t('管理导航台') }}</span>
    </div>
    <el-form ref="queryForm" :inline="true">
      <el-form-item :label="$t('日期范围')">
        <DatePicker
          v-model="dateRange"
          size="small"
          type="daterange"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t("重置") }}</el-button>
      </el-form-item>
    </el-form>
    <div class="noPad" style="height: calc(100% - 80px);overflow: auto;margin-right: -15px;padding-right: 10px;">
      <new-contract-report v-if="$store.getters.permissions.includes('deal:contract:view') || $store.getters.permissions.includes('*:*:*')" ref="newContractReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-payment-report v-if="$store.getters.permissions.includes('payment:report:view') || $store.getters.permissions.includes('*:*:*')" ref="latestPaymentReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-matters-report v-if="$store.getters.permissions.includes('matters:report:view') || $store.getters.permissions.includes('*:*:*')" ref="latestMattersReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-meeting-report v-if="$store.getters.permissions.includes('meeting:report:view') || $store.getters.permissions.includes('*:*:*')" ref="latestMeetingReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-compant-valuation-report v-if="$store.getters.permissions.includes('deal:companyvaluation:view') || $store.getters.permissions.includes('*:*:*')" ref="latestCompantValuationReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-establish-hhqy-report v-if="$store.getters.permissions.includes('hhqy:newestablish:view') || $store.getters.permissions.includes('*:*:*')" ref="latestEstablishHhqyReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-fund-found-report v-if="$store.getters.permissions.includes('fund:latestfound:view') || $store.getters.permissions.includes('*:*:*')" ref="latestFundFoundReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-servicing-plan-report v-if="$store.getters.permissions.includes('deal:planreport:view') || $store.getters.permissions.includes('*:*:*')" ref="latestServicingPlanReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
      <latest-deal-cash-flow-report v-if="$store.getters.permissions.includes('deal:cashflowreport:view') || $store.getters.permissions.includes('*:*:*')" ref="latestDealCashFlowReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" style="margin-bottom: 20px" />
      <latest-fund-cash-flow-report v-if="$store.getters.permissions.includes('fund:cashflowreport:view') || $store.getters.permissions.includes('*:*:*')" ref="latestFundCashFlowReport" class="margin" :date-range="dateRange" :query-prams-hidden="false" />
    </div>
  </div>
</template>

<script>
import NewContractReport from '@/views/report/newContractReport'
import LatestPaymentReport from '@/views/report/latestPaymentReport'
import LatestMattersReport from '@/views/report/latestMattersReport'
import LatestMeetingReport from '@/views/report/latestMeetingReport'
import LatestCompantValuationReport from '@/views/report/latestCompantValuationReport'
import LatestEstablishHhqyReport from '@/views/report/latestEstablishHhqyReport'
import LatestFundFoundReport from '@/views/report/latestFundFoundReport'
import LatestServicingPlanReport from '@/views/report/latestServicingPlanReport'
import LatestDealCashFlowReport from '@/views/report/latestDealCashFlowReport'
import LatestFundCashFlowReport from '@/views/report/latestFundCashFlowReport'
export default {
  components: { LatestFundCashFlowReport, LatestDealCashFlowReport, LatestServicingPlanReport, LatestFundFoundReport, LatestEstablishHhqyReport, LatestCompantValuationReport, LatestMeetingReport, LatestMattersReport, LatestPaymentReport, NewContractReport },
  data() {
    return {
      // 日期范围
      dateRange: [],
      loading: false
    }
  },
  created() {
  },
  methods: {
    /** 搜索按钮操作 */
    queryHandle() {
      var obj = {}
      for (obj in this.$refs) {
        if (this.$refs[obj]?.getList !== undefined) {
          this.$refs[obj].getList()
        }
      }
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = undefined
      // this.$refs.newContractReport.resetQuery()
      // this.$refs.latestPaymentReport.resetQuery()
      // this.$refs.latestMattersReport.resetQuery()
      // this.$refs.latestMeetingReport.resetQuery()
      // this.$refs.latestCompantValuationReport.resetQuery()
      // this.$refs.latestEstablishHhqyReport.resetQuery()
      // this.$refs.latestFundFoundReport.resetQuery()
      // this.$refs.latestServicingPlanReport.resetQuery()
      // this.$refs.latestDealCashFlowReport.resetQuery()
      // this.$refs.latestFundCashFlowReport.resetQuery()
      var obj = {}
      for (obj in this.$refs) {
        if (this.$refs[obj]?.resetQuery !== undefined) {
          this.$refs[obj].resetQuery()
        }
      }
    }
  }
}
</script>

<style scoped>
.margin {
  margin-bottom: 20px;
}
</style>
